package 
{	
	import flash.utils.getQualifiedClassName;
	import flash.xml.XMLDocument;
	import flash.xml.XMLNode;
	public function discoverXMLStructure( p_xml: XML):Array
	{
		var result :Array = new Array();

		try {
			result.push(p_xml.name());
		}catch (e:Error) {
			throw new Error( Log.ERROR_XML_EMPTY );
		}

		var current : * = p_xml.child(0);
		var max : int = 100;
		var rec : int = 0;
		var flag :Boolean
		do {
			node : for ( var item : String in current ) {
				if ( current[item].hasSimpleContent() ) {
					rec = max;
					flag = true;
					result.push(current.name());
				}else {
					result.push(current.name());
					current = current[item].child(0);
				}
				break node;
			}
			rec++;
		}while(rec<max)
		
		if (!flag) {
			throw new Error( Log.ERROR_XML_NO_NODES);
		}
		return result;
	}
}